import 'package:flutter/material.dart';
import 'package:get/get.dart';

/// Created by XieXin on 2020/8/7.
/// 卡片
class XCard extends StatelessWidget {
  final Widget? child;
  final Color? color;
  final Color? shadowColor;
  final double radius;

  const XCard({
    Key? key,
    this.child,
    this.color,
    this.shadowColor,
    this.radius = 0.0,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return DecoratedBox(
      decoration: BoxDecoration(
        color: color ?? (Get.isDarkMode ? Colors.white : Colors.white),
        borderRadius: BorderRadius.circular(radius),
        boxShadow: [
          BoxShadow(
            color: shadowColor ??
                (Get.isDarkMode ? const Color(0x80DCE7FA) : const Color(0x80DCE7FA)),
            offset: const Offset(0.0, 2.0),
            blurRadius: radius,
            spreadRadius: 0.0,
          ),
        ],
      ),
      child: child,
    );
  }
}
